var pageSize = 3;

jQuery(document).ready(function () {
    load();
});

function loadSettings() {
    pageSize = System.Gadget.Settings.read("pageSize") || 3;
    if (pageSize == "") {
        pageSize = 3;
    }
}
function load() {
    System.Gadget.onSettingsClosing = settingsClosing;
    loadSettings();

    $("select#selectPageSize").val(pageSize);

}
function settingsClosing(event) {
    if (event.closeAction == event.Action.commit) {
        saveSettings();
    }
    else if (event.closeAction == event.Action.cancel) {
    }
    event.cancel = false;
}
function saveSettings() {
    pageSize = $("select#selectPageSize").val();
    System.Gadget.Settings.write("pageSize", $("select#selectPageSize").val());
}